<?php

$data_actual = "'" . date("Y-m-d H:i:s") . "'";
$datas = $GLOBALS['MYT']->db_array("SELECT Prom_Start, Prom_End FROM promotions WHERE REF = 13");
$data_termina = $datas[1]['Prom_End'];
$data_inicia = $datas[1]['Prom_Start'];
$voucherNumber = $_POST['bns_GatherID'];
echo $voucherNumber;
$DadosVoucher = $GLOBALS['MYT']->db_array("select ncliente_indicado from promotion_voucher_comercial where id_voucher =
		{$voucherNumber}");

if (strlen($DadosVoucher[1]['ncliente_indicado']) <= 1) {
    $data = "'" . date("Y-m-d H:i:s") . "'";
    $data2 = date("Y-m-d H:i:s");
    $data_teste = date("Y-m-d H:i:s");
    $data1 = "2010-01-01 00:00:00";
    if (($data2 > $data_inicia) && ( $data2 < $data_termina )) {
        //echo $data_inicia;
        $GLOBALS['MYT']->db_query("update promotion_voucher_comercial set
                      ncliente_indicado = {$_POST['Gather_Client']},data = {$data} where id_voucher = {$voucherNumber} ");
    }
    echo 'Voucher Válido';
} else {
    echo 'Voucher Inválido';
    die;
}


